
self.onmessage = (e) => {
  console.log('company worker', e, e.data.organization)
  const allOrganizationUsersMap: Record<string, Record<string, any>> = {}
  e.data.organization.filter((item: any) => {
    if (allOrganizationUsersMap[item.CompanyId]) {
      allOrganizationUsersMap[item.CompanyId][item.UserId] = item
    } else {
      allOrganizationUsersMap[item.CompanyId] = {
        [item.UserId]: item
      }
    }
  })
  // self.postMessage(allOrganizationUsersMap)
  self.postMessage({ organizations: allOrganizationUsersMap })
}
